package com.yequan.hbb.presenter;

import android.util.Log;

import com.yequan.hbb.entries.AnswerEntries;
import com.yequan.hbb.entries.QuestionEntries;
import com.yequan.hbb.model.AnswerModel;
import com.yequan.hbb.view.QuestionView;

import retrofit2.Call;
import retrofit2.Response;

/**
 * Created by DingLong on 2016/10/14.
 */

public class AnswerPresenter extends MVPPresenter<QuestionView<QuestionEntries,AnswerEntries>,AnswerModel> implements AnswerModel.AnswerCallBack {

    private AnswerModel model;

    @Override
    public AnswerModel createModel() {
        model = new AnswerModel(this);
        return model;
    }

    public void getAnswerData(int contentId) {
        model.getData(contentId);
    }
    @Override
    public void onResponse(Call<AnswerEntries> call, Response<AnswerEntries> response) {
        getView().showAnswer(response.body());
    }

    @Override
    public void onFailure(Call<AnswerEntries> call, Throwable t) {
        Log.e("自定义标签", "类名==AnswerPresenter" + "方法名==onFailure=====:" + ""+t.toString());
    }
}
